var eg={};
eg.$=function (id) {
    return document.getElementById(id);
};
eg.addListener=function(){
    if (target.addEventListener){
        target.addEventListener(type,handler,false);
    } else if (target.attachEvent){
        target.attachEvent("on"+type,handler);
    } else
        target["on"+type]=handler;
};
eg.regCheck=function () {
    var username = eg.$("username");
    var password = eg.$("password");
    var confirmedPassword = eg.$("confirmedPassword");
    if (username.value===''){
        alert("username can't be none");
        eg.err();
        return false;
    }
    if (password.value===''){
        alert("password can't be none");
        eg.err();
        return false;
    }
    if (password.value!==confirmedPassword.value){
        alert("password is different");
        eg.err();
        return false;
    }

    var about=eg.$("about");
    if (about.value.length>60){
        alert("too long");
        eg.err();
        return false;
    }
    return true;
};

eg.addevent=function () {
    var pwd=eg.$("password");
    //eg.addListener(pwd,"keyup",function () {
    var lv=0;
    if (pwd.value.length<=6)
    {
        lv=30;
    }
    else if (pwd.value.length>6 && pwd.value.length<=12)
    {
        lv=60;
    }
    else lv=90;
    eg.$("PwdLv").style.width=lv+"px";

    //});
};
eg.addevent();
